<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/jsp/manage/common/taglibs.jsp" %>
<script type="text/javascript">
$(function() {
	$.acooly.framework.registerKeydown('manage_alarmList_searchform','manage_alarmList_datagrid');
});
function edit(id) {
        var saveBtn = {
            id: 'acooly-framework-add-btn',
            text: '编辑',
            handler: function () {
                var manage_alarm_parment_editform=serializeObject($('#manage_alarmList_editform'));
                $.post("/manage/lora/alarmList/alarmListUpdate.html",manage_alarm_parment_editform,function (r) {
                    $('#manage_alarmList_datagrid').datagrid('load');
                    $.parser.parse();
                    d.dialog('close');
                })

            }
        };
        var closeBtn = {
            text: '<i class="fa fa-times-circle fa-lg fa-fw fa-col" ></i>关闭',
            handler: function () {
                // var d = $(this).closest('.window-body');
                d.dialog('close');
            }
        };
        var buttons = buttons || [];
        buttons.push(saveBtn);
        buttons.push(closeBtn);
        var d = $('<div/>').dialog({
            href: "/manage/lora/alarmList/alarmListedit.html?id="+id,
            title: '编辑',
            width: 600,
            height: 500,
            modal: true,
            /*iconCls : 'icon-save',*/
            buttons:buttons,
            onClose: function () {
                $(this).dialog('destroy');
            }
        });
}
function alarmList_zt(value,row) {
    if(value==0){
        return "未处理";
    }else {
        return "已处理";
    }
}
// 批量处理
function manage_alarmList_batchHandle() {
    $.messager.confirm("批量处理", "是否确认批量处理选中项？", function (r) {
        if(r) {
            var rows = $('#manage_alarmList_datagrid').datagrid('getSelections');
            var ids = [];
            $.each(rows, function(i, v) {
                ids.push(v.id);
            });
            $.post('/manage/lora/alarmList/handleState.html', {ids: ids.join(',')}, function(r) {
                if(r.success) {
                    $.messager.show({
                        title: '提示',
                        msg: '批量处理成功！'
                    });
                    $('#manage_alarmList_datagrid').datagrid('reload');
                    $('#manage_alarmList_datagrid').datagrid('clearSelections');
                } else {
                    $.messager.show({
                        title: '提示',
                        msg: '批量处理失败'
                    });
                }
            }, 'json');
        }
    });
}
</script>
<div class="easyui-layout" data-options="fit : true,border : false">
  <!-- 查询条件 -->
  <div data-options="region:'north',border:false" style="padding:5px; overflow: hidden;" align="left">
    <form id="manage_alarmList_searchform" onsubmit="return false">
      <table class="tableForm" width="100%">
        <tr>
          <td align="left">
          	<div>
					设备编号: <input type="text" class="text" size="15" name="search_LIKE_epId"/>
					预警字段名称: <input type="text" class="text" size="15" name="search_LIKE_fieldName"/>
					预警字段名称: <input type="text" class="text" size="15" name="search_LIKE_fieldTitle"/>
                    处理状态: <select style="height:27px;width: 178px"  name="search_LIKE_handleStatus"  panelHeight="auto" class="easyui-combobox">
                        <option value="" ></option>
                        <option value="0" >未处理</option>
                        <option value="1" >已处理</option>
                    </select>
          	<a href="javascript:void(0);" class="easyui-linkbutton" data-options="plain:false" onclick="$.acooly.framework.search('manage_alarmList_searchform','manage_alarmList_datagrid');"><i class="fa fa-search fa-lg fa-fw fa-col"></i>查询</a>
          	</div>
          </td>
        </tr>
      </table>
    </form>
  </div>

  <!-- 列表和工具栏 -->
  <div data-options="region:'center',border:false">
    <table id="manage_alarmList_datagrid" class="easyui-datagrid" url="/manage/lora/alarmList/listJson.html" toolbar="#manage_alarmList_toolbar" fit="true" border="false" fitColumns="false"
      pagination="true" idField="id" pageSize="20" pageList="[ 10, 20, 30, 40, 50 ]" sortName="createTime" sortOrder="desc" checkOnSelect="true" selectOnCheck="true" singleSelect="false" >
      <thead>
        <tr>
        	<th field="showCheckboxWithId" checkbox="true" data-options="formatter:function(value, row, index){ return row.id }">编号</th>
			<th field="id" sortable="true" sum="true">ID</th>
			<th field="epId">设备编号</th>
			<th field="fieldTitle">预警类型</th>
			<th field="alarmInfo" formatter="contentFormatter">备注</th>
            <th field="createTime">报警时间</th>
            <th field="updateTime">处理时间</th>
			<th field="handleStatus" data-options="formatter:function(value, row, index){ return alarmList_zt(value,row) }" sortable="true">处理状态</th>
          	<th field="rowActions" data-options="formatter:function(value, row, index){return formatAction('manage_alarmList_action',value,row)}">动作</th>
        </tr>
      </thead>
    </table>

    <!-- 每行的Action动作模板 -->
    <div id="manage_alarmList_action" style="display: none;">
      <a onclick="edit('{0}')" href="#" title="编辑"><i class="fa fa-pencil fa-lg fa-fw fa-col"></i></a>
    <%--  <#--<a onclick="$.acooly.framework.show('/manage/lora/alarmList/show.html?id={0}',500,500);" href="#" title="查看"><i class="fa fa-file-o fa-lg fa-fw fa-col"></i></a>-->
--%>      <a onclick="$.acooly.framework.remove('/manage/lora/alarmList/deleteJson.html','{0}','manage_alarmList_datagrid');" href="#" title="删除"><i class="fa fa-trash-o fa-lg fa-fw fa-col"></i></a>
    </div>

    <!-- 表格的工具栏 -->
    <div id="manage_alarmList_toolbar">
     <a href="#" class="easyui-linkbutton" plain="true" onclick="manage_alarmList_batchHandle()"><i class="fa fa-plus-circle fa-lg fa-fw fa-col"></i>批量处理</a>
        <%--<a href="#" class="easyui-linkbutton" plain="true" onclick="$.acooly.framework.removes('/manage/lora/alarmList/deleteJson.html','manage_alarmList_datagrid')"><i class="fa fa-trash-o fa-lg fa-fw fa-col"></i>批量删除</a>
        <a href="#" class="easyui-menubutton" data-options="menu:'#manage_alarmList_exports_menu'"><i class="fa fa-arrow-circle-o-down fa-lg fa-fw fa-col"></i>批量导出</a>
        <div id="manage_alarmList_exports_menu" style="width:150px;">
          <div onclick="$.acooly.framework.exports('/manage/lora/alarmList/exportXls.html','manage_alarmList_searchform','lora_alarm_list')"><i class="fa fa-file-excel-o fa-lg fa-fw fa-col"></i>Excel</div>
          <div onclick="$.acooly.framework.exports('/manage/lora/alarmList/exportCsv.html','manage_alarmList_searchform','lora_alarm_list')"><i class="fa fa-file-text-o fa-lg fa-fw fa-col"></i>CSV</div>
        </div>
        <a href="#" class="easyui-linkbutton" plain="true" onclick="$.acooly.framework.imports({url:'/manage/lora/alarmList/importView.html',uploader:'manage_alarmList_import_uploader_file'});"><i class="fa fa-arrow-circle-o-up fa-lg fa-fw fa-col"></i>批量导入</a>
  --> --%>   </div>
  </div>

</div>
